using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using TMS.Api.StaticClasses;
using TMS.Application.Common.Interface;
using TMS.Application.RequestDto;
using TMS.Domain.Entity;

namespace TMS.Api.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class GetClassDataController : ControllerBase
    {
        private readonly IRepository<College> _College;
        private readonly IRepository<Major> _Major;
        private readonly IRepository<Class> _Class;
        private readonly IRepository<Students> _Students;
        private readonly IRepository<Term> appTerm;

        public GetClassDataController(IRepository<Term> appTerms,IRepository<Students> Students,IRepository<Class> Class, IRepository<Major> Major, IRepository<College> College)
        {
            appTerm=appTerms;

            _Students=Students;

            _Class = Class;

            _College = College;

            _Major = Major;
        }

        // 获得某个班级里面所有学生
        [HttpGet("/GetClassStu/{id}")]
        public object ClassStu(Guid id)
        {
            
            var students= _Students.Table.Where(x=>x.ClassId==id).ToList();

            return students;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
        }

        


        // 获得所有班级
        [HttpGet("/GetClass")]
        public object ClassData()
        {

           
            var GetClassData = new ClassData();

            var classdata = GetClassData.Class(_College, _Major, _Class);

            return classdata;

        }


    }
}